<?php
// 本类由系统自动生成，仅供测试用途
namespace Admin\Controller;
use Think\Controller;
class LinkController extends baseActionController {
     public function lists(){
    	$urllink = M("urllink");
    	$arr = $urllink->select();
        $this->assign("arr",$arr);
        $this->display();
    }

     //添加
	public function add(){
		$this->display();
	}
	public function doadd(){
      	$stu = D('urllink');
		if($stu->create()){
			$stu->add();
			$this->success('添加成功',U('link/lists'));
		}else{
			$this->error('添加失败',U('link/lists'));
		}
}
	//删除
	public function del(){
        $urllink = M("urllink");
        $id=I('uid');
        $create=$urllink->delete($id);
        if(false == $urllink->delete()){
            $this->success("删除成功!",U("link/lists"));
        }else{
            $this->error("删除失败!",U("link/lists"));
        }
    }
	//修改
	public function edit(){
		$id = $_GET['uid'];
 		$vo = M('urllink')->where("id={$id}")->select();
		$this->assign('vvo',$vo);		
		$this->display();
	}
	public function doedit(){
		$stu = D('urllink');
		if($stu->create()){
			$stu->save();
			$this->success('编辑成功',U('link/lists'));
		}else{
			$this->error('编辑失败',U('link/edit'));
		
		}
	}
}